package camtburist.app02.web.controller;


import camtburist.app02.bean.Article;
import camtburist.app02.service.IArticleServic;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(description = "栏目管理相关接口")
@RestController
@RequestMapping("article")
public class ArticleController {
    @Autowired
    private IArticleServic categoryService;

    @ApiOperation(value = "查询所有")
    @GetMapping("findAll")
    public List<Article> findAll(){
        return categoryService.findAll();

    }
    @ApiOperation(value = "保存或更新")
    @PostMapping("saveOrUpdate")
    public String saveOrUpdate(Article article){
        categoryService.saveOrupdate(article);
       return "更新成功";
    }
    @ApiOperation(value="删除")
    @GetMapping("deleteById")
    public String deleteById(long id){
        categoryService.deleteById(id);
        return "删除成功";
    }
}
